<?php

namespace common\models\business;

use Yii;

/**
 * This is the model class for table "business_disease_type".
 *
 * @property string $id
 * @property integer $name
 * @property string $detail
 * @property integer $createtime
 */
class BusinessDiseaseType extends \yii\db\ActiveRecord
{


    //主要用于日志记录
    public $uselog = [
        'tabcomment' => '疾病类型',      //用于修改了什么的显示
        'mainfield' => 'name',      //主要的显示标题的字段
        'picturefield' => [],        //图片字段
        'timefield' => [],       //时间字段
        'unsetfiled' =>[],      //不需要记录的字段
    ];



    const STATUS_SHOW = 1;
    const STATUS_HIDDDEN = 0;
    public static $statues = [
        self::STATUS_SHOW => '启用',
        self::STATUS_HIDDDEN => '不启用',
    ];


    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'business_disease_type';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['name', 'detail'], 'required'],
            [['createtime','status'], 'integer'],
            [['name'], 'string', 'max' => 30],
            [['detail'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'name' => '疾病名称',
            'detail' => '相关症状',
            'status' => '状态',
            'createtime' => '创建时间',
        ];
    }



    public function beforeSave($insert)
    {
        $this->createtime = time();
        return parent::beforeSave($insert); // TODO: Change the autogenerated stub
    }
}
